package com.pentakill.mo.essay.discuss.web;

import com.pentakill.mo.auth.user.vo.UserModel;
import com.pentakill.mo.essay.discuss.business.ebi.DiscussEbi;
import com.pentakill.mo.essay.discuss.vo.DiscussModel;
import com.pentakill.mo.essay.essay.business.ebi.EssayEbi;
import com.pentakill.mo.essay.essay.vo.EssayModel;
import com.pentakill.mo.util.base.BaseAction;

public class DiscussAction extends BaseAction{
	//公开
	public DiscussModel dm;
	public EssayModel em;
	
	//注入
	private DiscussEbi discussEbi;
	private EssayEbi essayEbi;
	
	
	
	public void setEssayEbi(EssayEbi essayEbi) {
		this.essayEbi = essayEbi;
	}
	public void setDiscussEbi(DiscussEbi discussEbi) {
		this.discussEbi = discussEbi;
	}
	
	
	//添加评论
	public String add(){
		UserModel user = (UserModel) getSession("user");
		//判断用户是否登录和文章是否有uuid
		if (user != null && em.getUuid()!= null) {
			
			//判断是新评论还是回复
			if (dm.getUuid() == null ) {
				//新评论
				//判断文章
					essayEbi.createDiscuss(user,em.getUuid(),dm);
			}else {
				//回复
				//当前回复评论uuid
				essayEbi.replyDiscuss(user,em.getUuid(),dm);
				
			}
		}
		//	public DiscussModel dm;
//		public EssayModel em;
		//返回该文章
		return null;
	}
}
